<!----***头部****----->
function dialogOpen(url,width,height,name){
	var xposition = (screen.width - width) / 2;
	var yposition = (screen.height - height-25) / 2;
	var iframeId = 'iframeId_'+new Date().getTime();
	var windowId = 'windowId_'+new Date().getTime() ;
	url = encodeURI(url);
	windowOpen(url, windowId, name, height, width, true, iframeId, window);
}


// 导航显示二级主菜单
var visMnu = "";
var actMnu;
var visId = "";
var actId;
//一级菜单中的字体颜色控制
var linkIdPre;
var linkIdNow;
function changeColor(obj,outerId) {

	linkIdPre = linkIdNow;
	linkIdNow = obj;

    preLink = linkIdPre;
    nowLink = linkIdNow;

	if(preLink != null)
       preLink.style.color='#fff';

	if(nowLink != null)
	   nowLink.style.color='#1C1439';

	if(outerId.className == "nav_first_chosen"){

       obj.style.color='#1C1439';
	}else if(outerId.className == ""){
       obj.style.color='#fff';
	}
}

function flipMenu(actMnu , id){
	var actMnu = document.getElementById(actMnu);
	var	actId = document.getElementById(id);
   if (visId == "")
      showMenu(actMnu, actId);
   else{
         hideMenu(visMnu, visId);
         showMenu(actMnu, actId);
   }
}
function showMenu(actMnu, actId)
{
	if(actMnu != null)
	{//alert('hhh');
	 actMnu.style.display = "block";
//	 actMnu.style.className= "nav_second_chooseItem";
	// var spanObjs = actMnu.getElementsByTagName('span');

//	alert(spanObjs.length);
	var tdObj = actMnu.getElementsByTagName('td');
//	alert(tdObj.length);

	for(var i=0;i<tdObj.length;i++){
		//alert(tdObj[i].id);
		if(tdObj[i].id != '')

		tdObj[i].className = "";
	}

	tdObj[0].className = "nav_second_chooseItem";

	tdObj[0].firstChild.click();
	tdObj[0].firstChild.fireEvent("ondblclick");
	//spanObjs[0].className ="nav_second_chooseItem";
//	for(var i=2;i<tdObj.length;i=i+2){
//		tdObj[i].className ="";
//	}
//	 actMnu.firstChild.firstChild.firstChild.className ="nav_second_chooseItem";
	//alert(actMnu.firstChild);
/*
	 //二级菜单显示时初始选中第一个子菜单
	 if(actMnu.id == "nav_second_sale") {
	    document.getElementById("firstItem").className="nav_second_chooseItem";
	    document.getElementById("secondItem").className="";
        document.getElementById("thirdItem").className="";
	    document.getElementById("forthItem").className="";
     } else if(actMnu.id == "nav_sceond_customer") {
	    document.getElementById("firstItem11").className="nav_second_chooseItem";
	    document.getElementById("secondItem12").className="";
        document.getElementById("thirdItem13").className="";
	    document.getElementById("forthItem14").className="";
	 }
	 */
   }

   actId.className = "nav_first_chosen";

	changeColor(actId.firstChild,actId);


   visId = actId;
   visMnu = actMnu;
}
function hideMenu(actMnu, actId)
{
	if(actMnu != null)
	{
   actMnu.style.display = "none";
   }
   actId.className = "";
   visId = "";
   visMnu = "";
}

//二级菜单点击切换css样式
function turnChoose(obj, parentId) {
  //alert('hhhds');
   var parent = document.getElementById(parentId);
//	var spanObjs = parent.getElementsByTagName('span');
	var tdObj = parent.getElementsByTagName('td');
	for(var i=0;i<tdObj.length;i++){
		//alert(tdObj[i].id);
		if(tdObj[i].id != '')

		tdObj[i].className = "";
	}
	 obj.className="nav_second_chooseItem";
	 /*
   if(obj.id == "firstItem") {
      document.getElementById("secondItem").className="";
      document.getElementById("thirdItem").className="";
	  document.getElementById("forthItem").className="";
	  document.getElementById("fifthItem").className="";
   } else if(obj.id == "secondItem") {
      document.getElementById("firstItem").className="";
      document.getElementById("thirdItem").className="";
	  document.getElementById("forthItem").className="";
	  document.getElementById("fifthItem").className="";
   } else if(obj.id == "thirdItem") {
      document.getElementById("firstItem").className="";
      document.getElementById("secondItem").className="";
	  document.getElementById("forthItem").className="";
	  document.getElementById("fifthItem").className="";
   } else if(obj.id == "forthItem") {
	  document.getElementById("firstItem").className="";
      document.getElementById("secondItem").className="";
	  document.getElementById("thirdItem").className="";
	  document.getElementById("fifthItem").className="";
   }
   else if(obj.id == "fifthItem") {
	  document.getElementById("firstItem").className="";
      document.getElementById("secondItem").className="";
	  document.getElementById("thirdItem").className="";
	  document.getElementById("forthItem").className="";
   }

   if(obj.id == "firstItem11") {
      document.getElementById("secondItem12").className="";
      document.getElementById("thirdItem13").className="";
	  document.getElementById("forthItem14").className="";
   } else if(obj.id == "secondItem12") {
      document.getElementById("firstItem11").className="";
      document.getElementById("thirdItem13").className="";
	  document.getElementById("forthItem14").className="";
   } else if(obj.id == "thirdItem13") {
      document.getElementById("firstItem11").className="";
      document.getElementById("secondItem12").className="";
	  document.getElementById("forthItem14").className="";
   } else if(obj.id == "forthItem14") {
	  document.getElementById("firstItem11").className="";
      document.getElementById("secondItem12").className="";
	  document.getElementById("thirdItem13").className="";
   }
   */
}


 function getAbsPoint(obj)
 {
      var    x,y;
      oRect    =    obj.getBoundingClientRect();
     x=oRect.left
     y=oRect.top
     alert("("+x+","+y+")")
 }

//三级菜单

function showThird(id,itemObj){

	var divObj = document.getElementById(id);
	var oRect = itemObj.getBoundingClientRect();
	if(divObj == null)
		return;
	//alert(divObj);
	divObj.style.left=oRect.left;
	divObj.style.top=oRect.top;
//	alert(divObj.style.top);alert(divObj.style.left);
 divObj.style.display="block";
 //var popup = window.createPopup();
// alert(divObj.innerHTML);
// popup.document.body.innerHTML = divObj.innerHTML;
 //popup.show(oRect.left,oRect.top,200,300);
 divObj.focus();
}
function hideThird(id){
//	alert(id);
	var divObj;
	if(typeof id == 'object'){//如果是对象类型，判定为div对象
		divObj = id;
	}else{
		divObj = document.getElementById(id);
	}
//	alert(divObj);
	if(divObj == null)
		return;

 divObj.style.display="none";

}

function linkTarget(url){
	document.getElementById('main').src=url;

}


//快捷菜单选中效果
 var gListOver = null;
function outListTr1(obj){
	if(obj != gListOver){
		obj.className = "fastmenu_off";
	}
}
function clickListTr1(obj){
	if(gListOver == null){
		obj.className = "fastmenu_chosen";
	} else {
		if (gListOver != obj) {
			gListOver.className = "fastmenu_off";
			obj.className = "fastmenu_chosen";
		}
	}
	gListOver = obj;
}


function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

//头部菜单选中效果--楼盘展示
var gListOver = null;
function clickListTr_show(obj){
	if(gListOver == null){
		obj.className = "fastmenu_chosen_show";
	} else {
		if (gListOver != obj) {
			gListOver.className = "fastmenu_off_show";
			obj.className = "fastmenu_chosen_show";
		}
	}
	gListOver = obj;
}
